package com.cowin.inf.controller;

import com.cowin.base.annotation.InterfaceAnnotation;
import com.cowin.base.annotation.LogAnnotation;
import com.cowin.base.result.Result;
import com.cowin.inf.model.RouteModule;
import com.cowin.inf.service.BdcRouteService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Copyright (C), 1998-2018, 奇瑞信息
 *
 * @author : 于超
 * @Date: 2019/9/3 8:57
 * @Description: 路由点交互控制器
 */
@Slf4j
@Api(value = "BdcRouteController", description = "路由点控制器", tags = "BdcRouteController", consumes = "application/json")
@RestController
@RequestMapping("inf/bdc/route")
public class BdcRouteController {
    @Resource
    private BdcRouteService bdcRouteService;

    @ApiOperation(value = "路由点接口", notes = "路由点接口")
    @LogAnnotation("路由点接口")
    @InterfaceAnnotation("BDC_POINT_ROUTER")
    @PostMapping("/key")
    public Result getRouter(@RequestBody RouteModule routeModule) {
        return bdcRouteService.getRouter(routeModule);
    }

    @ApiOperation(value = "过点接口", notes = "过点接口")
    @LogAnnotation("过点接口")
    @InterfaceAnnotation("BDC_POINT_RECORD")
    @PostMapping("/point/record")
    public Result pointRecord(@RequestBody RouteModule routeModule) {
        return bdcRouteService.pointRecord(routeModule);
    }

    @ApiOperation(value = "SET_IN SET_OUT接口", notes = "SET_IN SET_OUT接口")
    @InterfaceAnnotation("BDC_SET_IN_OUT")
    @LogAnnotation("SET_IN SET_OUT接口")
    @PostMapping("/bound")
    public Result inOutBound(@RequestBody RouteModule routeModule) {
        return bdcRouteService.inOutBound(routeModule);
    }
}
